		TITLE	CEXTDEF - Copyright (c) 1988-94 by SLR Systems

		INCLUDE MACROS
		INCLUDE	SYMBOLS
		INCLUDE	CDDATA

		PUBLIC	CEXTDEF

;
;		FOR FIXUPPS THAT REFERENCE COMDEFS...
;

		.DATA

		EXTERNDEF	COMDAT_FLAGS:BYTE

		EXTERNDEF	END_OF_RECORD:DWORD,BUFFER_OFFSET:DWORD

		EXTERNDEF	SYMBOL_LARRAY:LARRAY_STRUCT,SYMBOL_GARRAY:STD_PTR_S


		.CODE	PASS1_TEXT

		EXTERNDEF	OBJ_PHASE:PROC,MYCOMDAT_INSTALL:PROC,COMDAT_INSTALL:PROC,STORE_XREF_ENTRY:PROC


CEXTDEF1	PROC		;USES
		;
		;DS:SI IS RECORD POINTER
		;
;		JMP	TEST_CEXT

		DOLONG	C0			;HANDLE INDEX >128

CEXT_LOOP:
		NEXT_INDEX	C0		;LNAME INDEX

		MOV	BUFFER_OFFSET,ESI
		CALL	MYCOMDAT_INSTALL	;INSTALL OR FIND IN LOCAL TABLE
		;
		;EAX = LINDEX, ECX = PHYS
		;
		ASSUME	ECX:PTR MYCOMDAT_STRUCT
		MOV	EBX,[ECX]._MCD_SYMBOL_GINDEX
		MOV	EDI,ECX

		TEST	EBX,EBX
		JNZ	L2$

		MOV	COMDAT_FLAGS,BL		;ZERO
		CALL	COMDAT_INSTALL		;EAX IS LNAME_INDEX, RETURN SYMBOL_GINDEX, ECX IS SYMBOL
		ASSUME	ECX:PTR SYMBOL_STRUCT
		MOV	EBX,EAX
L1$:
		OR	[ECX]._S_REF_FLAGS,MASK S_SOFT_REF
if	fg_xref
		GETT	DL,XREF_OUT
		MOV	AL,[ECX]._S_REF_FLAGS

		TEST	DL,DL
		JZ	L3$

		AND	AL,MASK S_SPACES		;LOCAL SYMBOL?
		JNZ	L3$

		MOV	EAX,EBX
		CALL	STORE_XREF_ENTRY
L3$:
endif
		ASSUME	EDI:PTR MYCOMDAT_STRUCT
		MOV	[EDI]._MCD_SYMBOL_GINDEX,EBX
		MOV	EAX,EBX

		INSTALL_GINDEX_LINDEX	SYMBOL_LARRAY	;STORE PLEASE

		SKIP_INDEX			;SKIP CODEVIEW INFORMATION

CEXTDEF		LABEL	PROC

TEST_CEXT:
		CMP	END_OF_RECORD,ESI
		JA	CEXT_LOOP

		JNZ	ERROR

		RET

L2$:
		;
		;INSTALL IN EXTDEF TABLE
		;
		CONVERT	ECX,EBX,SYMBOL_GARRAY
		JMP	L1$

ERROR:
		CALL	OBJ_PHASE
		RET

CEXTDEF1	ENDP


		END

